import os
import cv2

imgs = []
img_dir = "/data/ylm/code/pythonCode/GeoFormer/GeoFormer-main/data/datasets/Oxford"
for curDir, dirs, files in os.walk(img_dir):        
    fs = [os.path.join(curDir, x) for x in files]

    for i in fs:
        (path, filename) = os.path.split(i)

        if (i.endswith('.jpg') or i.endswith('.ppm')):
            imgs.append(i)
for file_path in imgs:
    try:
        image = cv2.imread(file_path, cv2.IMREAD_GRAYSCALE)
        height, width = image.shape[0:2]
    except:
        print(file_path)
        

# /data/ylm/code/pythonCode/GeoFormer/GeoFormer-main/data/datasets/Oxford/paris/louvre/paris_louvre_000146.jpg
# /data/ylm/code/pythonCode/GeoFormer/GeoFormer-main/data/datasets/Oxford/paris/louvre/paris_louvre_000136.jpg
# /data/ylm/code/pythonCode/GeoFormer/GeoFormer-main/data/datasets/Oxford/paris/moulinrouge/paris_moulinrouge_000422.jpg